/********************************************************************
FileName    :   Dal_hykblH.cs
CreateTime  :   2019-01-17 01:01
BaseClass   :   Dal_hykblH
FileType    :   .cs
Author      :  minjie
Description :   Dal_hykblHDAL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
namespace HT.DAL
{
	/// <summary>
	/// Dal_hykblH的摘要说明。
	/// </summary>
	public partial class Dal_hykblH 
  	{ 
     		      
  		public bool Exists() 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) from hykblH"); 
           SqlParameter[] parameters = { };  
          			return DbHelperSQL.Exists(strSql.ToString(),parameters); 
  		} 
  		 
  				 
  		 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  bool  Add(hykblH_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into hykblH(");			 
  	        strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,dmbh,dmmc,khbh,khmc,kh,dh,dz,hyzk,hykye,xfzjf,jfye,zjxfjf,zjxfsj,hykzt,sffsdx,rq,sj,djyh,djsj,xgyh,mm,xgsj,bz,srmm,cfsrmm,sfz,sr,xb,ykh,IndexCount,UploadStatus) values ("); 
  	        strSql.Append("	@DjLsh,@DjBtZdh,@DjFtZdh,@DjStZdh,@DjState,@DjCount,@dmbh,@dmmc,@khbh,@khmc,@kh,@dh,@dz,@hyzk,@hykye,@xfzjf,@jfye,@zjxfjf,@zjxfsj,@hykzt,@sffsdx,@rq,@sj,@djyh,@djsj,@xgyh,@mm,@xgsj,@bz,@srmm,@cfsrmm,@sfz,@sr,@xb,@ykh,@IndexCount,@UploadStatus	 ) "); 
  			SqlParameter[] parameters = { 
              new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjFtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjStZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@DjCount", SqlDbType.Int,4) ,              
              new SqlParameter("@dmbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dmmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@khbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@khmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@kh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@hyzk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@hykye", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xfzjf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jfye", SqlDbType.Decimal,9) ,              
              new SqlParameter("@zjxfjf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@zjxfsj", SqlDbType.DateTime) ,              
              new SqlParameter("@hykzt", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sffsdx", SqlDbType.Bit) ,              
              new SqlParameter("@rq", SqlDbType.DateTime) ,              
              new SqlParameter("@sj", SqlDbType.DateTime) ,              
              new SqlParameter("@djyh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@djsj", SqlDbType.DateTime) ,              
              new SqlParameter("@xgyh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@mm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xgsj", SqlDbType.DateTime) ,              
              new SqlParameter("@bz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@srmm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@cfsrmm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sfz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sr", SqlDbType.DateTime) ,              
              new SqlParameter("@xb", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ykh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@IndexCount", SqlDbType.Int,4) ,              
              new SqlParameter("@UploadStatus", SqlDbType.Int,4)};             
              parameters[0].Value = model.DjLsh;  
              
              parameters[1].Value = model.DjBtZdh;  
              
              parameters[2].Value = model.DjFtZdh;  
              
              parameters[3].Value = model.DjStZdh;  
              
           if (model.DjState != null)  
              parameters[4].Value = model.DjState;  
           else  
              parameters[4].Value = DBNull.Value;  
              
              parameters[5].Value = model.DjCount;  
              
           if (model.dmbh != null)  
              parameters[6].Value = model.dmbh;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.dmmc != null)  
              parameters[7].Value = model.dmmc;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.khbh != null)  
              parameters[8].Value = model.khbh;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.khmc != null)  
              parameters[9].Value = model.khmc;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.kh != null)  
              parameters[10].Value = model.kh;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.dh != null)  
              parameters[11].Value = model.dh;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.dz != null)  
              parameters[12].Value = model.dz;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.hyzk != null)  
              parameters[13].Value = model.hyzk;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.hykye != null)  
              parameters[14].Value = model.hykye;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.xfzjf != null)  
              parameters[15].Value = model.xfzjf;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.jfye != null)  
              parameters[16].Value = model.jfye;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.zjxfjf != null)  
              parameters[17].Value = model.zjxfjf;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.zjxfsj != null)  
              parameters[18].Value = model.zjxfsj;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.hykzt != null)  
              parameters[19].Value = model.hykzt;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.sffsdx != null)  
              parameters[20].Value = model.sffsdx;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.rq != null)  
              parameters[21].Value = model.rq;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.sj != null)  
              parameters[22].Value = model.sj;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.djyh != null)  
              parameters[23].Value = model.djyh;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.djsj != null)  
              parameters[24].Value = model.djsj;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.xgyh != null)  
              parameters[25].Value = model.xgyh;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.mm != null)  
              parameters[26].Value = model.mm;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.xgsj != null)  
              parameters[27].Value = model.xgsj;  
           else  
              parameters[27].Value = DBNull.Value;  
              
           if (model.bz != null)  
              parameters[28].Value = model.bz;  
           else  
              parameters[28].Value = DBNull.Value;  
              
           if (model.srmm != null)  
              parameters[29].Value = model.srmm;  
           else  
              parameters[29].Value = DBNull.Value;  
              
           if (model.cfsrmm != null)  
              parameters[30].Value = model.cfsrmm;  
           else  
              parameters[30].Value = DBNull.Value;  
              
           if (model.sfz != null)  
              parameters[31].Value = model.sfz;  
           else  
              parameters[31].Value = DBNull.Value;  
              
           if (model.sr != null)  
              parameters[32].Value = model.sr;  
           else  
              parameters[32].Value = DBNull.Value;  
              
           if (model.xb != null)  
              parameters[33].Value = model.xb;  
           else  
              parameters[33].Value = DBNull.Value;  
              
           if (model.ykh != null)  
              parameters[34].Value = model.ykh;  
           else  
              parameters[34].Value = DBNull.Value;  
              
              parameters[35].Value = model.IndexCount;  
              
              parameters[36].Value = model.UploadStatus;  
              
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);			 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
              return false;; 
           }  
  		} 
  		 
  		/// <summary> 
  		/// 增加一条数据(字符串) 
  		/// </summary> 
  		public  string  AddStr(hykblH_Entity model) 
  		{ 
  				if(model.DjLsh==null) 
  				{ 
  					model.DjLsh=0; 
  				} 
  				if(model.DjBtZdh==null) 
  				{ 
  					model.DjBtZdh=0; 
  				} 
  				if(model.DjFtZdh==null) 
  				{ 
  					model.DjFtZdh=0; 
  				} 
  				if(model.DjStZdh==null) 
  				{ 
  					model.DjStZdh=0; 
  				} 
  				if(model.DjState==null) 
  				{ 
  					model.DjState="";  
  				} 
  				if(model.DjCount==null) 
  				{ 
  					model.DjCount=0; 
  				} 
  				if(model.dmbh==null) 
  				{ 
  					model.dmbh="";  
  				} 
  				if(model.dmmc==null) 
  				{ 
  					model.dmmc="";  
  				} 
  				if(model.khbh==null) 
  				{ 
  					model.khbh="";  
  				} 
  				if(model.khmc==null) 
  				{ 
  					model.khmc="";  
  				} 
  				if(model.kh==null) 
  				{ 
  					model.kh="";  
  				} 
  				if(model.dh==null) 
  				{ 
  					model.dh="";  
  				} 
  				if(model.dz==null) 
  				{ 
  					model.dz="";  
  				} 
  				if(model.hyzk==null) 
  				{ 
  					model.hyzk=0; 
  				} 
  				if(model.hykye==null) 
  				{ 
  					model.hykye=0; 
  				} 
  				if(model.xfzjf==null) 
  				{ 
  					model.xfzjf=0; 
  				} 
  				if(model.jfye==null) 
  				{ 
  					model.jfye=0; 
  				} 
  				if(model.zjxfjf==null) 
  				{ 
  					model.zjxfjf=0; 
  				} 
  				if(model.hykzt==null) 
  				{ 
  					model.hykzt="";  
  				} 
  				if(model.sffsdx==null) 
  				{ 
  					model.sffsdx=false;  
  				} 
  				if(model.djyh==null) 
  				{ 
  					model.djyh="";  
  				} 
  				if(model.xgyh==null) 
  				{ 
  					model.xgyh="";  
  				} 
  				if(model.mm==null) 
  				{ 
  					model.mm="";  
  				} 
  				if(model.bz==null) 
  				{ 
  					model.bz="";  
  				} 
  				if(model.srmm==null) 
  				{ 
  					model.srmm="";  
  				} 
  				if(model.cfsrmm==null) 
  				{ 
  					model.cfsrmm="";  
  				} 
  				if(model.sfz==null) 
  				{ 
  					model.sfz="";  
  				} 
  				if(model.xb==null) 
  				{ 
  					model.xb="";  
  				} 
  				if(model.ykh==null) 
  				{ 
  					model.ykh="";  
  				} 
  				if(model.IndexCount==null) 
  				{ 
  					model.IndexCount=0; 
  				} 
  				if(model.UploadStatus==null) 
  				{ 
  					model.UploadStatus=0; 
  				} 
  		 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into hykblH(");			 
  	        strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,dmbh,dmmc,khbh,khmc,kh,dh,dz,hyzk,hykye,xfzjf,jfye,zjxfjf,zjxfsj,hykzt,sffsdx,rq,sj,djyh,djsj,xgyh,mm,xgsj,bz,srmm,cfsrmm,sfz,sr,xb,ykh,IndexCount,UploadStatus) values ("); 
  	        strSql.Append("	"+ model.DjLsh+","+ model.DjBtZdh+","+ model.DjFtZdh+","+ model.DjStZdh+",'"+ model.DjState+"',"+ model.DjCount+",'"+ model.dmbh+"','"+ model.dmmc+"','"+ model.khbh+"','"+ model.khmc+"','"+ model.kh+"','"+ model.dh+"','"+ model.dz+"',"+ model.hyzk+","+ model.hykye+","+ model.xfzjf+","+ model.jfye+","+ model.zjxfjf+",'"+ model.zjxfsj+"','"+ model.hykzt+"','"+ model.sffsdx+"','"+ model.rq+"','"+ model.sj+"','"+ model.djyh+"','"+ model.djsj+"','"+ model.xgyh+"','"+ model.mm+"','"+ model.xgsj+"','"+ model.bz+"','"+ model.srmm+"','"+ model.cfsrmm+"','"+ model.sfz+"','"+ model.sr+"','"+ model.xb+"','"+ model.ykh+"',"+ model.IndexCount+"," +model.UploadStatus+"	 ) "); 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(hykblH_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update hykblH set "); 
                      strSql.Append(" DjLsh = @DjLsh,"); 
              strSql.Append(" DjBtZdh = @DjBtZdh,"); 
              strSql.Append(" DjFtZdh = @DjFtZdh,"); 
              strSql.Append(" DjStZdh = @DjStZdh,"); 
              strSql.Append(" DjState = @DjState,"); 
              strSql.Append(" DjCount = @DjCount,"); 
              strSql.Append(" dmbh = @dmbh,"); 
              strSql.Append(" dmmc = @dmmc,"); 
              strSql.Append(" khbh = @khbh,"); 
              strSql.Append(" khmc = @khmc,"); 
              strSql.Append(" kh = @kh,"); 
              strSql.Append(" dh = @dh,"); 
              strSql.Append(" dz = @dz,"); 
              strSql.Append(" hyzk = @hyzk,"); 
              strSql.Append(" hykye = @hykye,"); 
              strSql.Append(" xfzjf = @xfzjf,"); 
              strSql.Append(" jfye = @jfye,"); 
              strSql.Append(" zjxfjf = @zjxfjf,"); 
              strSql.Append(" zjxfsj = @zjxfsj,"); 
              strSql.Append(" hykzt = @hykzt,"); 
              strSql.Append(" sffsdx = @sffsdx,"); 
              strSql.Append(" rq = @rq,"); 
              strSql.Append(" sj = @sj,"); 
              strSql.Append(" djyh = @djyh,"); 
              strSql.Append(" djsj = @djsj,"); 
              strSql.Append(" xgyh = @xgyh,"); 
              strSql.Append(" mm = @mm,"); 
              strSql.Append(" xgsj = @xgsj,"); 
              strSql.Append(" bz = @bz,"); 
              strSql.Append(" srmm = @srmm,"); 
              strSql.Append(" cfsrmm = @cfsrmm,"); 
              strSql.Append(" sfz = @sfz,"); 
              strSql.Append(" sr = @sr,"); 
              strSql.Append(" xb = @xb,"); 
              strSql.Append(" ykh = @ykh,"); 
              strSql.Append(" IndexCount = @IndexCount,"); 
              strSql.Append(" UploadStatus = @UploadStatus"); 
  			strSql.Append(" where   "); 
  						 
           SqlParameter[] parameters = { 
                      new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjFtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjStZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@DjCount", SqlDbType.Int,4) ,              
              new SqlParameter("@dmbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dmmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@khbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@khmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@kh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@hyzk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@hykye", SqlDbType.Decimal,9) ,              
              new SqlParameter("@xfzjf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jfye", SqlDbType.Decimal,9) ,              
              new SqlParameter("@zjxfjf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@zjxfsj", SqlDbType.DateTime) ,              
              new SqlParameter("@hykzt", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sffsdx", SqlDbType.Bit) ,              
              new SqlParameter("@rq", SqlDbType.DateTime) ,              
              new SqlParameter("@sj", SqlDbType.DateTime) ,              
              new SqlParameter("@djyh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@djsj", SqlDbType.DateTime) ,              
              new SqlParameter("@xgyh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@mm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xgsj", SqlDbType.DateTime) ,              
              new SqlParameter("@bz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@srmm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@cfsrmm", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sfz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sr", SqlDbType.DateTime) ,              
              new SqlParameter("@xb", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ykh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@IndexCount", SqlDbType.Int,4) ,              
              new SqlParameter("@UploadStatus", SqlDbType.Int,4)};             
                   if (model.DjLsh != null)  
              parameters[0].Value = model.DjLsh;  
           else  
              parameters[0].Value = DBNull.Value;  
              
           if (model.DjBtZdh != null)  
              parameters[1].Value = model.DjBtZdh;  
           else  
              parameters[1].Value = DBNull.Value;  
              
           if (model.DjFtZdh != null)  
              parameters[2].Value = model.DjFtZdh;  
           else  
              parameters[2].Value = DBNull.Value;  
              
           if (model.DjStZdh != null)  
              parameters[3].Value = model.DjStZdh;  
           else  
              parameters[3].Value = DBNull.Value;  
              
           if (model.DjState != null)  
              parameters[4].Value = model.DjState;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.DjCount != null)  
              parameters[5].Value = model.DjCount;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.dmbh != null)  
              parameters[6].Value = model.dmbh;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.dmmc != null)  
              parameters[7].Value = model.dmmc;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.khbh != null)  
              parameters[8].Value = model.khbh;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.khmc != null)  
              parameters[9].Value = model.khmc;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.kh != null)  
              parameters[10].Value = model.kh;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.dh != null)  
              parameters[11].Value = model.dh;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.dz != null)  
              parameters[12].Value = model.dz;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.hyzk != null)  
              parameters[13].Value = model.hyzk;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.hykye != null)  
              parameters[14].Value = model.hykye;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.xfzjf != null)  
              parameters[15].Value = model.xfzjf;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.jfye != null)  
              parameters[16].Value = model.jfye;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.zjxfjf != null)  
              parameters[17].Value = model.zjxfjf;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.zjxfsj != null)  
              parameters[18].Value = model.zjxfsj;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.hykzt != null)  
              parameters[19].Value = model.hykzt;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.sffsdx != null)  
              parameters[20].Value = model.sffsdx;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.rq != null)  
              parameters[21].Value = model.rq;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.sj != null)  
              parameters[22].Value = model.sj;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.djyh != null)  
              parameters[23].Value = model.djyh;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.djsj != null)  
              parameters[24].Value = model.djsj;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.xgyh != null)  
              parameters[25].Value = model.xgyh;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.mm != null)  
              parameters[26].Value = model.mm;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.xgsj != null)  
              parameters[27].Value = model.xgsj;  
           else  
              parameters[27].Value = DBNull.Value;  
              
           if (model.bz != null)  
              parameters[28].Value = model.bz;  
           else  
              parameters[28].Value = DBNull.Value;  
              
           if (model.srmm != null)  
              parameters[29].Value = model.srmm;  
           else  
              parameters[29].Value = DBNull.Value;  
              
           if (model.cfsrmm != null)  
              parameters[30].Value = model.cfsrmm;  
           else  
              parameters[30].Value = DBNull.Value;  
              
           if (model.sfz != null)  
              parameters[31].Value = model.sfz;  
           else  
              parameters[31].Value = DBNull.Value;  
              
           if (model.sr != null)  
              parameters[32].Value = model.sr;  
           else  
              parameters[32].Value = DBNull.Value;  
              
           if (model.xb != null)  
              parameters[33].Value = model.xb;  
           else  
              parameters[33].Value = DBNull.Value;  
              
           if (model.ykh != null)  
              parameters[34].Value = model.ykh;  
           else  
              parameters[34].Value = DBNull.Value;  
              
           if (model.IndexCount != null)  
              parameters[35].Value = model.IndexCount;  
           else  
              parameters[35].Value = DBNull.Value;  
              
           if (model.UploadStatus != null)  
              parameters[36].Value = model.UploadStatus;  
           else  
              parameters[36].Value = DBNull.Value;  
              
           int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据(字符串) 2016-07-13更新 
  		///   2017-03-23更新 minjie 
  		/// </summary> 
  		public  string  UpdateStr(hykblH_Entity model) 
  		{ 
  				if(model.DjLsh==null) 
  				{ 
  					model.DjLsh=0; 
  				} 
  				if(model.DjBtZdh==null) 
  				{ 
  					model.DjBtZdh=0; 
  				} 
  				if(model.DjFtZdh==null) 
  				{ 
  					model.DjFtZdh=0; 
  				} 
  				if(model.DjStZdh==null) 
  				{ 
  					model.DjStZdh=0; 
  				} 
  				if(model.DjState==null) 
  				{ 
  					model.DjState="";  
  				} 
  				if(model.DjCount==null) 
  				{ 
  					model.DjCount=0; 
  				} 
  				if(model.dmbh==null) 
  				{ 
  					model.dmbh="";  
  				} 
  				if(model.dmmc==null) 
  				{ 
  					model.dmmc="";  
  				} 
  				if(model.khbh==null) 
  				{ 
  					model.khbh="";  
  				} 
  				if(model.khmc==null) 
  				{ 
  					model.khmc="";  
  				} 
  				if(model.kh==null) 
  				{ 
  					model.kh="";  
  				} 
  				if(model.dh==null) 
  				{ 
  					model.dh="";  
  				} 
  				if(model.dz==null) 
  				{ 
  					model.dz="";  
  				} 
  				if(model.hyzk==null) 
  				{ 
  					model.hyzk=0; 
  				} 
  				if(model.hykye==null) 
  				{ 
  					model.hykye=0; 
  				} 
  				if(model.xfzjf==null) 
  				{ 
  					model.xfzjf=0; 
  				} 
  				if(model.jfye==null) 
  				{ 
  					model.jfye=0; 
  				} 
  				if(model.zjxfjf==null) 
  				{ 
  					model.zjxfjf=0; 
  				} 
  				if(model.hykzt==null) 
  				{ 
  					model.hykzt="";  
  				} 
  				if(model.sffsdx==null) 
  				{ 
  					model.sffsdx=false;  
  				} 
  				if(model.djyh==null) 
  				{ 
  					model.djyh="";  
  				} 
  				if(model.xgyh==null) 
  				{ 
  					model.xgyh="";  
  				} 
  				if(model.mm==null) 
  				{ 
  					model.mm="";  
  				} 
  				if(model.bz==null) 
  				{ 
  					model.bz="";  
  				} 
  				if(model.srmm==null) 
  				{ 
  					model.srmm="";  
  				} 
  				if(model.cfsrmm==null) 
  				{ 
  					model.cfsrmm="";  
  				} 
  				if(model.sfz==null) 
  				{ 
  					model.sfz="";  
  				} 
  				if(model.xb==null) 
  				{ 
  					model.xb="";  
  				} 
  				if(model.ykh==null) 
  				{ 
  					model.ykh="";  
  				} 
  				if(model.IndexCount==null) 
  				{ 
  					model.IndexCount=0; 
  				} 
  				if(model.UploadStatus==null) 
  				{ 
  					model.UploadStatus=0; 
  				} 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update hykblH set "); 
              strSql.Append(" DjLsh = "+model.DjLsh+","); 
              strSql.Append(" DjBtZdh = "+model.DjBtZdh+","); 
              strSql.Append(" DjFtZdh = "+model.DjFtZdh+","); 
              strSql.Append(" DjStZdh = "+model.DjStZdh+","); 
              strSql.Append(" DjState ='"+ model.DjState+"',"); 
              strSql.Append(" DjCount = "+model.DjCount+","); 
              strSql.Append(" dmbh ='"+ model.dmbh+"',"); 
              strSql.Append(" dmmc ='"+ model.dmmc+"',"); 
              strSql.Append(" khbh ='"+ model.khbh+"',"); 
              strSql.Append(" khmc ='"+ model.khmc+"',"); 
              strSql.Append(" kh ='"+ model.kh+"',"); 
              strSql.Append(" dh ='"+ model.dh+"',"); 
              strSql.Append(" dz ='"+ model.dz+"',"); 
              strSql.Append(" hyzk = "+model.hyzk+","); 
              strSql.Append(" hykye = "+model.hykye+","); 
              strSql.Append(" xfzjf = "+model.xfzjf+","); 
              strSql.Append(" jfye = "+model.jfye+","); 
              strSql.Append(" zjxfjf = "+model.zjxfjf+","); 
              strSql.Append(" zjxfsj ='"+ model.zjxfsj+"',"); 
              strSql.Append(" hykzt ='"+ model.hykzt+"',"); 
              strSql.Append(" sffsdx = '"+model.sffsdx+"'"); 
              strSql.Append(" rq ='"+ model.rq+"',"); 
              strSql.Append(" sj ='"+ model.sj+"',"); 
              strSql.Append(" djyh ='"+ model.djyh+"',"); 
              strSql.Append(" djsj ='"+ model.djsj+"',"); 
              strSql.Append(" xgyh ='"+ model.xgyh+"',"); 
              strSql.Append(" mm ='"+ model.mm+"',"); 
              strSql.Append(" xgsj ='"+ model.xgsj+"',"); 
              strSql.Append(" bz ='"+ model.bz+"',"); 
              strSql.Append(" srmm ='"+ model.srmm+"',"); 
              strSql.Append(" cfsrmm ='"+ model.cfsrmm+"',"); 
              strSql.Append(" sfz ='"+ model.sfz+"',"); 
              strSql.Append(" sr ='"+ model.sr+"',"); 
              strSql.Append(" xb ='"+ model.xb+"',"); 
              strSql.Append(" ykh ='"+ model.ykh+"',"); 
              strSql.Append(" IndexCount = "+model.IndexCount+","); 
              strSql.Append(" UploadStatus ="+ model.UploadStatus+""); 
  			strSql.Append(" where   "); 
  						 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete() 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from hykblH "); 
  			strSql.Append(" where  "); 
           SqlParameter[] parameters = { };  
  			 
   
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string lists ) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from hykblH "); 
  			strSql.Append(" where ID in ("+ lists + ")  "); 
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString()); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public hykblH_Entity GetModel() 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select  DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,dmbh,dmmc,khbh,khmc,kh,dh,dz,hyzk,hykye,xfzjf,jfye,zjxfjf,zjxfsj,hykzt,sffsdx,rq,sj,djyh,djsj,xgyh,mm,xgsj,bz,srmm,cfsrmm,sfz,sr,xb,ykh,IndexCount,UploadStatus");			 
  	        strSql.Append("  from hykblH"); 
  			strSql.Append(" where   "); 
           SqlParameter[] parameters = { };  
  			 
  			 
  			hykblH_Entity model=new hykblH_Entity(); 
  			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); 
  		        DataTable dt=ds.Tables[0];	  
  				return DataTableToEntity(dt); 
  		} 
  		 
  		 
  		 
  		 
  		/// <summary> 
  		/// 将数据集(DataTable)转换 对象 hykblH_Entity
  		/// 创建人：minjie 
  		/// 创建时间:2019-01-17 01:36:37 
  		/// </summary> 
  		public hykblH_Entity DataTableToEntity(DataTable dt) 
  		{ 
  			hykblH_Entity model=new hykblH_Entity(); 
  			 
  			if(dt!=null&&dt.Rows.Count>0) 
  			{ 
  				if(dt.Rows[0]["DjLsh"]!=null&&dt.Rows[0]["DjLsh"].ToString()!="") 
  				{ 
  					model.DjLsh=int.Parse(dt.Rows[0]["DjLsh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjBtZdh"]!=null&&dt.Rows[0]["DjBtZdh"].ToString()!="") 
  				{ 
  					model.DjBtZdh=int.Parse(dt.Rows[0]["DjBtZdh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjFtZdh"]!=null&&dt.Rows[0]["DjFtZdh"].ToString()!="") 
  				{ 
  					model.DjFtZdh=int.Parse(dt.Rows[0]["DjFtZdh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjStZdh"]!=null&&dt.Rows[0]["DjStZdh"].ToString()!="") 
  				{ 
  					model.DjStZdh=int.Parse(dt.Rows[0]["DjStZdh"].ToString()); 
  				} 
  				model.DjState= dt.Rows[0]["DjState"].ToString(); 
  				if(dt.Rows[0]["DjCount"]!=null&&dt.Rows[0]["DjCount"].ToString()!="") 
  				{ 
  					model.DjCount=int.Parse(dt.Rows[0]["DjCount"].ToString()); 
  				} 
  				model.dmbh= dt.Rows[0]["dmbh"].ToString(); 
  				model.dmmc= dt.Rows[0]["dmmc"].ToString(); 
  				model.khbh= dt.Rows[0]["khbh"].ToString(); 
  				model.khmc= dt.Rows[0]["khmc"].ToString(); 
  				model.kh= dt.Rows[0]["kh"].ToString(); 
  				model.dh= dt.Rows[0]["dh"].ToString(); 
  				model.dz= dt.Rows[0]["dz"].ToString(); 
  				if(dt.Rows[0]["hyzk"]!=null&&dt.Rows[0]["hyzk"].ToString()!="") 
  				{ 
  					model.hyzk=decimal.Parse(dt.Rows[0]["hyzk"].ToString()); 
  				} 
  				if(dt.Rows[0]["hykye"]!=null&&dt.Rows[0]["hykye"].ToString()!="") 
  				{ 
  					model.hykye=decimal.Parse(dt.Rows[0]["hykye"].ToString()); 
  				} 
  				if(dt.Rows[0]["xfzjf"]!=null&&dt.Rows[0]["xfzjf"].ToString()!="") 
  				{ 
  					model.xfzjf=decimal.Parse(dt.Rows[0]["xfzjf"].ToString()); 
  				} 
  				if(dt.Rows[0]["jfye"]!=null&&dt.Rows[0]["jfye"].ToString()!="") 
  				{ 
  					model.jfye=decimal.Parse(dt.Rows[0]["jfye"].ToString()); 
  				} 
  				if(dt.Rows[0]["zjxfjf"]!=null&&dt.Rows[0]["zjxfjf"].ToString()!="") 
  				{ 
  					model.zjxfjf=decimal.Parse(dt.Rows[0]["zjxfjf"].ToString()); 
  				} 
  				if(dt.Rows[0]["zjxfsj"]!=null&&dt.Rows[0]["zjxfsj"].ToString()!="") 
  				{ 
  					model.zjxfsj=DateTime.Parse(dt.Rows[0]["zjxfsj"].ToString()); 
  				} 
  				model.hykzt= dt.Rows[0]["hykzt"].ToString(); 
  				if(dt.Rows[0]["sffsdx"]!=null&&dt.Rows[0]["sffsdx"].ToString()!="") 
  				{ 
  					if((dt.Rows[0]["sffsdx"].ToString()=="1")||(dt.Rows[0]["sffsdx"].ToString().ToLower()=="true")) 
  					{ 
  					model.sffsdx= true; 
  					} 
  					else 
  					{ 
  					model.sffsdx= false; 
  					} 
  				} 
  				if(dt.Rows[0]["rq"]!=null&&dt.Rows[0]["rq"].ToString()!="") 
  				{ 
  					model.rq=DateTime.Parse(dt.Rows[0]["rq"].ToString()); 
  				} 
  				if(dt.Rows[0]["sj"]!=null&&dt.Rows[0]["sj"].ToString()!="") 
  				{ 
  					model.sj=DateTime.Parse(dt.Rows[0]["sj"].ToString()); 
  				} 
  				model.djyh= dt.Rows[0]["djyh"].ToString(); 
  				if(dt.Rows[0]["djsj"]!=null&&dt.Rows[0]["djsj"].ToString()!="") 
  				{ 
  					model.djsj=DateTime.Parse(dt.Rows[0]["djsj"].ToString()); 
  				} 
  				model.xgyh= dt.Rows[0]["xgyh"].ToString(); 
  				model.mm= dt.Rows[0]["mm"].ToString(); 
  				if(dt.Rows[0]["xgsj"]!=null&&dt.Rows[0]["xgsj"].ToString()!="") 
  				{ 
  					model.xgsj=DateTime.Parse(dt.Rows[0]["xgsj"].ToString()); 
  				} 
  				model.bz= dt.Rows[0]["bz"].ToString(); 
  				model.srmm= dt.Rows[0]["srmm"].ToString(); 
  				model.cfsrmm= dt.Rows[0]["cfsrmm"].ToString(); 
  				model.sfz= dt.Rows[0]["sfz"].ToString(); 
  				if(dt.Rows[0]["sr"]!=null&&dt.Rows[0]["sr"].ToString()!="") 
  				{ 
  					model.sr=DateTime.Parse(dt.Rows[0]["sr"].ToString()); 
  				} 
  				model.xb= dt.Rows[0]["xb"].ToString(); 
  				model.ykh= dt.Rows[0]["ykh"].ToString(); 
  				if(dt.Rows[0]["IndexCount"]!=null&&dt.Rows[0]["IndexCount"].ToString()!="") 
  				{ 
  					model.IndexCount=int.Parse(dt.Rows[0]["IndexCount"].ToString()); 
  				} 
  				if(dt.Rows[0]["UploadStatus"]!=null&&dt.Rows[0]["UploadStatus"].ToString()!="") 
  				{ 
  					model.UploadStatus=int.Parse(dt.Rows[0]["UploadStatus"].ToString()); 
  				} 
  				return model; 
  			} 
  			else 
  			{ 
  				return null; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 分页获取数据列表 
  		/// </summary> 
  		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  		 strSql.Append("SELECT * FROM ( "); 
  		 strSql.Append(" SELECT ROW_NUMBER() OVER ("); 
  if (!string.IsNullOrEmpty(orderby.Trim())) 
 { 
    strSql.Append("order by " ); 
 } 
else  
 { 
     strSql.Append("order by  desc"); 
 } 
		 strSql.Append(")AS Row, T.*  from hykblH T "); 
  		 if (!string.IsNullOrEmpty(strWhere.Trim()))  
  			{ 
  			 strSql.Append(" WHERE " + strWhere); 
  			} 
  		    strSql.Append(" ) TT"); 
  	        strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select * "); 
  			strSql.Append(" FROM hykblH "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select "); 
  			if(Top>0) 
  			{ 
  				strSql.Append(" top "+Top.ToString()); 
  			} 
  			strSql.Append(" * "); 
  			strSql.Append(" FROM hykblH "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			strSql.Append(" order by " + filedOrder); 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		/// <summary> 
  		/// 批量处理  
  		/// </summary> 
  		public int ExecuteSqlTran(List<string> ls,ref string error) 
  		{ 
  			return DbHelperSQL.ExecuteSqlTran(ls,ref   error); 
  		} 
  		 
  		/// <summary> 
  		/// 执行sql语句  
  		/// </summary> 
  		public int ExecuteSql(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteSql(sql); 
  		} 
  		 
  		/// <summary> 
  		/// 执行sql语句  
  		/// </summary> 
  		public string GetSingle(string sql) 
  		{ 
  			object obj= DbHelperSQL.GetSingle(sql); 
  			 if (obj != null) 
  			 { 
  			    return obj.ToString(); 
  		     } 
  		     else 
  		        return ""; 
  		} 
  		 
  		/// <summary> 
  		/// 执行sql语句  
  		/// </summary> 
  		public DataTable  ExecuteDt(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteDt(sql); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得记录条数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) "); 
  			strSql.Append(" FROM hykblH "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  		   object obj=	DbHelperSQL.GetSingle(strSql.ToString()); 
  			if(obj!=null && obj.ToString()!="") 
  			{ 
              	return Convert.ToInt32(obj); 
  			} 
  			else 
  			return 0; 
  		} 
   
      
  	} 
  
}
